//
//  NSArray+PYSortByString.m
//  catuncel
//
//  Created by Jim on 2018/3/9.
//  Copyright © 2018年 Jim. All rights reserved.
//

#import "NSArray+PYSortByString.h"

@implementation NSArray (PYSortByString)

- (NSArray *)sortByString;
{
//    NSStringCompareOptions comparisonOptions = NSCaseInsensitiveSearch|NSNumericSearch|
//
//    NSWidthInsensitiveSearch|NSForcedOrderingSearch|NSDiacriticInsensitiveSearch;
//
//    NSComparator sort = ^(NSString *obj1, NSString *obj2) {
//
//        NSRange range = NSMakeRange(0, obj1.length);
//
//        return [obj1 compare:obj2 options:comparisonOptions range:range];
//
//    };
//
//    NSArray *array = [self sortedArrayUsingComparator:sort];
    
    return [self sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        
        NSComparisonResult result = [obj1 compare:obj2];
        
        return result == NSOrderedAscending; // 升序
        //        return result == NSOrderedAscending;  // 降序
    }];
    
}

@end
